package aiowang.springframe.mybatisspring.dao;

import aiowang.springframe.mybatis.pojo.User;
import aiowang.springframe.mybatisspring.mapper.UserMapper;
import org.mybatis.spring.SqlSessionTemplate;

import java.util.List;

/**
 * @author aiowang
 * @description:
 * @date 2021/8/17 13:36
 */
public class UserDaoImpl implements UserMapper {

    //sqlSession不用我们自己创建了，Spring来管理
    private SqlSessionTemplate sqlSession;

    public void setSqlSession(SqlSessionTemplate sqlSession) {
        this.sqlSession = sqlSession;
    }

    @Override
    public List<User> selectUser() {
        UserMapper mapper = sqlSession.getMapper(UserMapper.class);
        return mapper.selectUser();
    }
}
